<template>
    <view class="pagebox">
        <uni-card>
            <uni-table border stripe >
                <uni-tr>
                    <uni-th class="bbb">入库时间</uni-th>
                    <uni-th class="bbb">计划进度(%)</uni-th>
                    <uni-th class="bbb">校正进度(%)</uni-th>
                </uni-tr>
                <uni-tr>
                    <uni-td class="bbb">2012-04-04</uni-td>
                    <uni-td class="bbb"><input class="inputt" v-model="plan_progress" type="text" placeholder="请输入">  </uni-td>
                    <uni-td class="bbb"><input class="inputt" v-model="total_progress" type="text" placeholder="请输入"> </uni-td>
                </uni-tr>
            </uni-table>
        </uni-card>
        <uni-card>
            <Showprogress ref="gridTable" align="center" :keyval="keyval" :proplist="proplist"></Showprogress>
        </uni-card>
    </view>

</template>

<script>
    import Showprogress from '@/components/showprogress.vue'
    export default{
        name:"bigprop",
        data(){
            return{
                oid:'',
                total_progress:'',
                plan_progress:'',
                proplist:[],
                keyval:null
            }
        },
        onNavigationBarButtonTap(e){
            console.log(e)
            if(e.index == 0){
                if(!this.total_progress || !this.plan_progress){
                    this.$error("计划进度/校正进度不能为空")
                    return
                }
                this.$api.post(`produce/progress`,{
                    oid:this.oid,
                    total_progress:this.total_progress,
                    plan_progress:this.plan_progress,
                    keyval:this.keyval
                }).then(()=>{
                    uni.$emit('progress',{
                        oid:this.oid
                    })
                    uni.navigateBack({data:1})
                })
                
            }
        },
        components:{
            Showprogress
        },
        onLoad(option) {
            this.oid = option.oid
            this.total_progress = option.total_progress
            this.plan_progress = option.plan_progress
            this.getlists()
            var _this = this
            setTimeout(function(){
                _this.$refs.gridTable.updatetable()
            },500)
            
            // #ifdef APP-PLUS
            uni.lockOrientation('landscape')
           // #endif
           
        },
        onUnload() {
           // #ifdef APP-PLUS 
           uni.unlockOrientation()  
           // #endif
        },
        methods:{
            getlists(){
                this.$api.get(`prop/getlists?oid=${this.oid}`).then(({data})=>{
                    this.proplist = data.lists
                    this.keyval = data.keyval
                 
                })
            }
        }
    }
</script>

<style lang="less" scoped>

    .bbb{
        font-size: 24rpx;
        width: 250rpx;
    }
    .inputt{
        border-bottom:1px solid #999;
        font-size: 24rpx;
    }
</style>